package com.subaiwang.service.officialWebsite;

import com.subaiwang.dao.official.OfficialTypeMapper;
import com.subaiwang.pojo.OfficialType;
import com.subaiwang.pojo.Pages;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("officialTypeService")
public class OfficialTypeServiceImpl implements OfficialTypeService{
    @Resource
    private OfficialTypeMapper officialTypeMapper;
    @Override
    public void getOfficialType(String typename, String content, Pages pages) {
       List<OfficialType> list=officialTypeMapper.getOfficialType(typename,content,((pages.getPageNo()-1)*pages.getPageSize()),pages.getPageSize());
       pages.setOfficialTypeList(list);
    }

    @Override
    public int getCount3(String typename, String content) {
        return officialTypeMapper.getCount3(typename, content);
    }

    @Override
    public boolean addOfficialType(OfficialType officialType) {
        boolean flag=false;
        int count=officialTypeMapper.addOfficialType(officialType);
        if(count>0){
            flag=true;
        }
        return flag;
    }
}
